import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import React from "react";
// import { getYearData } from "./selectData";
import "./_style.less";
import DevSelect from "~/public/cpas-ui/components-ui/express-components/DevSelect";
import { getYears } from "../../../tools/Tools";
export class DevSelects extends React.Component {
    yearVal;
    getYearOption;
    constructor(props) {
        super(props);
        console.log("接收参数值", props);
        const { placeholder, yearVals } = props;
        // this.yearVal = "2023";
        this.state = {
            getYears: [],
            placeholder,
            yearVals,
        };
    }
    // 年度做动态交互
    YearOptions(yearVal) {
        // let yearVal = "2023";
        const getYearOptions = [
            {
                value: Number(yearVal) - 5,
                label: "上五年",
            },
            {
                value: Number(yearVal) - 4,
                label: "上四年",
            },
            {
                value: Number(yearVal) - 3,
                label: "上三年",
            },
            {
                value: Number(yearVal) - 2,
                label: "上两年",
            },
            {
                value: Number(yearVal) - 1,
                label: "上一年",
            },
            {
                value: Number(yearVal),
                label: "本年",
            },
            {
                value: Number(yearVal) + 1,
                label: "下一年",
            },
            {
                value: Number(yearVal) + 2,
                label: "下两年",
            },
            {
                value: Number(yearVal) + 3,
                label: "下三年",
            },
        ];
        this.setState({
            getYears: getYearOptions,
        });
        // this.getYearOption = getYearOptions[5].label;
        // console.log("333--this.getYearOption", this.getYearOption);
    }
    getAllYears = async (params) => {
        const data = await getYears(params);
        console.log(11, data);
    };
    componentDidMount() {
        this.getAllYears("本年");
        console.log("本年", this.getAllYears("本年"));
        console.log("是否有值", this.YearOptions(2019));
        // this.getData(this.yearVal);
        //年度下拉组件的使用，它要动态的去获取当前项目的当前年度
        // let sessionParam = JSON.parse(
        //   window.sessionStorage.getItem("electronParams")
        // );
        // if (sessionParam && sessionParam?.params.sjnd) {
        //   this.YearOptions(sessionParam?.params.sjnd); // 年度下拉
        // } else {
        //   this.YearOptions(this.props.yearVals); // 年度下拉
        // }
    }
    render() {
        return (_jsx(_Fragment, { children: _jsx("div", { children: _jsx(DevSelect, { dataSource: this.state.getYears, displayExpr: "label", valueExpr: "label", placeholder: this.props.placeholder, showClearButton: false, value: this.props.yearVals, defaultValue: this.props.yearVals, onValueChanged: (e) => this.props.onValueChanged(e), yearVals: this.props.yearVals }) }) }));
    }
}
export default DevSelects;
